﻿using System;
using System.Collections.Generic;
using System.Text;
using NLBS.Entity;
using NLBS.Framework;
using NLBS.Data;
using NLBS.Data.Business;
using NLBS.Control;

namespace NLBS.Web.UI
{
    public class AdminCallBackHelp:CallBackBase
    {

        public AdminCallBackHelp(System.Web.UI.Control control,string[] parameters)
        {
            this.SourceControl = control;
            this.Page = control.Page;
            this.parameter = parameters[0];
            this.parameters = parameters;
            if (CheckControlLength)
                CreateCommand();
            commands[parameter].Excute();
            
        }

        public Dictionary<string, ICommand> commands;


        public void CreateCommand()
        {
            commands = new Dictionary<string, ICommand>();
            commands.Add("message", new ControlCommand("/Admin/control/message.ascx", this));
            commands.Add("settings", new ControlCommand("/Admin/control/settings.ascx", this));
            commands.Add("categoryContent", new ControlCommand("/Admin/control/categoryContent.ascx", this));
            commands.Add("group", new ControlCommand("/Admin/control/userGroup.ascx", this));
            commands.Add("smile", new ControlCommand("/Admin/control/smile.ascx", this));
            commands.Add("wordFilter", new ControlCommand("/Admin/control/wordFilter.ascx", this));
            commands.Add("database", new ControlCommand("/Admin/control/database.ascx", this));
            commands.Add("attachments", new ControlCommand("/Admin/control/attachments.ascx", this));
            commands.Add("announce", new ControlCommand("/Admin/control/announce.ascx", this));
            commands.Add("linkContent", new ControlCommand("/Admin/control/linkContent.ascx", this));
            commands.Add("misc", new ControlCommand("/Admin/control/misc.ascx", this));
            commands.Add("widget", new ControlCommand("/Admin/control/widget.ascx", this));
            commands.Add("extensionLink", new ControlCommand("/Admin/control/extensionLink.ascx", this));
            commands.Add("plugins", new ControlCommand("/Admin/control/Plugins.ascx", this));
            commands.Add("comment", new ControlCommand("/Admin/control/comment.ascx", this));
            commands.Add("theme", new ControlCommand("/Admin/control/theme.ascx", this));

            commands.Add("saveCategory", new CategoryCommand(Action.Insert, parameters));
            commands.Add("deleteCategory", new CategoryCommand(Action.Delete, parameters));
            commands.Add("moveCategory", new CategoryCommand(Action.Update, parameters));
            commands.Add("deleteSmile", new SmileCommand(Action.Delete, parameters));
            commands.Add("savesmile", new SmileCommand(Action.Insert, parameters));
            commands.Add("updateUserGroup", new UserGroupCommand(Action.Insert, parameters));
            commands.Add("deleteUserGroup", new UserGroupCommand(Action.Delete, parameters));
            commands.Add("saveWordFilter", new WordFilterCommand(Action.Insert, parameters));
            commands.Add("deleteWordFilter", new WordFilterCommand(Action.Delete, parameters));

            commands.Add("saveWidget", new WidgetCommand(Action.Insert, parameters));
            commands.Add("deleteWidget", new WidgetCommand(Action.Delete, parameters));
            commands.Add("saveExtensionLink", new ExtensionLinkCommand(Action.Insert, parameters));
            commands.Add("deleteExtensionLink", new ExtensionLinkCommand(Action.Delete, parameters));

            commands.Add("Install", new PluginCommand("Install", parameters));
            commands.Add("UnInstall", new PluginCommand("UnInstall", parameters));

            commands.Add("resync_g", new MiscCommand("resync_g"));
            commands.Add("resync_c", new MiscCommand("resync_c"));
            commands.Add("resync_a", new MiscCommand("resync_a"));
            commands.Add("resync_u", new MiscCommand("resync_u"));
            commands.Add("clean_u", new MiscCommand("clean_u"));
            commands.Add("clean_vc", new MiscCommand("clean_vc"));
            commands.Add("clean_gb", new MiscCommand("clean_gb"));

            commands.Add("updateLink", new SettingCommand(parameters));
            commands.Add("updateAnnounce", new SettingCommand(parameters));
            commands.Add("updateSettings", new SettingCommand(parameters));
            commands.Add("changeTheme", new SettingCommand(parameters));
            commands.Add("openSite", new SettingCommand(parameters));
            commands.Add("closedSite", new SettingCommand(parameters));
            commands.Add("clearCache", new SettingCommand(parameters));
            //changeTheme
            commands.Add("panelCategory", new ControlCommand(new PanelCategory(), this));
            commands.Add("panelArticle", new ControlCommand(new PanelArticle(), this));
            commands.Add("panelComment", new ControlCommand(new PanelComment(), this));
            commands.Add("panelArchive", new ControlCommand(new PanelArchive(), this));
            commands.Add("panelGuestBook", new ControlCommand(new PanelGuestBook(), this));
            commands.Add("panelLink", new ControlCommand(new PanelLink(), this));
            commands.Add("panelStats", new ControlCommand(new PanelStatus(), this));
            commands.Add("panelUser", new ControlCommand("panelUser.ascx", this));
            commands.Add("articleList", new ControlCommand("content.ascx", this));
            commands.Add("singleArticle", new ControlCommand("firstContent.ascx", this));
            commands.Add("guestbooklist", new ControlCommand("/Control/guestbook.ascx", this));
            commands.Add("commentlist", new ControlCommand("/Control/comment.ascx", this));
            commands.Add("trackbacklist", new ControlCommand("/Control/trackBack.ascx", this));
            commands.Add("userlist", new ControlCommand("user.ascx", this));
            commands.Add("userDetails", new ControlCommand("userDetails.ascx", this));
            commands.Add("registerView", new ControlCommand("register.ascx", this));
            commands.Add("articleCommentList", new ControlCommand("commentList.ascx", this));

            commands.Add("addcomment", new CommentCommand(Action.Insert, this));
            commands.Add("deleteComment", new CommentCommand(Action.Delete, this));
            commands.Add("deleteMulitComment", new CommentCommand(Action.DeleteMulit, this));
            
            commands.Add("addGuestBook", new GuestBookCommand(Action.Insert, this));
            commands.Add("deleteGuestBook", new GuestBookCommand(Action.Delete, this));

            commands.Add("deleteMulitGuestbook", new GuestBookCommand(Action.DeleteMulit, this));
            commands.Add("validateUser", new UserCommand(Action.Select, this));
            commands.Add("registerUser", new UserCommand(Action.Insert, this));
            commands.Add("updateUser", new UserCommand(Action.Update, this));
            commands.Add("deleteUser", new UserCommand(Action.Delete, this));
            commands.Add("deleteTrackBack", new TrackBackCommand(Action.Delete,this));
            commands.Add("deleteMulitTrackback", new TrackBackCommand(Action.DeleteMulit, this));
        }
    }
}
